package com.lintcode.solution;

public class Solution_366 {
    public static void main(String[] args) {
        System.out.println(fibonacci(10));
    }
    
    public static int fibonacci(int n) {
        if (n == 1) {
            return 0;
        }
        if (n == 2) {
            return 1;
        }
        int a = 0, b = 1, c;
        for (int i = 2; i < n; i++) {
            c = b;
            b = a + b;
            a = c;
        }
        return b;
    }
}
